package ch.ethz.eai.test;

import junit.framework.TestCase;

import ch.ethz.eai.data.Location;
import ch.ethz.eai.data.PointOfInterest;
import ch.ethz.eai.data.WeatherStatus;
import ch.ethz.eai.facade.GeocodeFacade;
import ch.ethz.eai.facade.SearchFacade;
import ch.ethz.eai.facade.WeatherFacade;

public class ServiceTester extends TestCase 
{
	
	public void testGeocodeService() 
	{
		Location l = new Location("Bachlerstrasse", "Zuerich", "8046", "Switzerland");
		Location[] res = GeocodeFacade.geocode(l);
		for (Location lres : res)
		{
			System.out.println(lres);
		}
		System.out.println("Other direction:");
		if (res.length>0) 
		{
			Location[] resRev = GeocodeFacade.reverseGeocode(res[0]);
			for (Location lres : resRev)
			{
				System.out.println(lres);
			}
		}
		
		assertTrue(res.length>0);
	}
	
	
	public void testSearchService() 
	{
		int cnt = 0;
		for (PointOfInterest poi : SearchFacade.getPOIs(new Location("", "Berlin", "", "Germany"), "hotel" + ""))
		{
			System.out.println(poi);
			cnt++;
		}
		
		assertTrue(cnt>0);
	}
	
	
	public void testWeatherService() 
	{
		WeatherStatus res = WeatherFacade.getWeatherFor(new Location("Budapest", "Hungary"));
		assertNotNull(res);
		System.out.println(res);
	}
	
}
